import Request from 'utils/request';

export default class PersonalCenterApi {
  static getPersonalClassifyData() {
    const apiName = 'api/wehcatshop/getWechatFuncControllerList';

    return Request.post(apiName, {
      type: 2
    }, true, false).then(res => {
      let typeList = res.data;
      typeList = typeList.map(obj => obj.id);
      return typeList;
    });
  }

  static sendCode(phone) {
    const apiName = 'api/wehcatshop/sendSms';

    return Request.post(apiName, {
      phone
    }).then(res => {
      return res.msg;
    });
  }

  static toBindPhone(bindData) {
    const apiName = 'api/wehcatshop/userBindPhone';
    let postData = bindData.getObject();

    return Request.post(apiName, postData).then(res => {
      return res.msg;
    });
  }
}
